package com.pan.feign;

import com.pan.entity.Coupon;
import com.pan.entity.Result;
import com.pan.vo.CouponShowVo;
import com.pan.vo.UserCouponShowVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("coupon-server")
public interface CouponFeign {

    @ResponseBody
    @GetMapping("/coupon/select")
    public Result<List<Coupon>> select();

    @ResponseBody
    @GetMapping("/coupon/select/id/{id}")
    public Result<CouponShowVo> selectById(@PathVariable("id") Long id);


    @ResponseBody
    @GetMapping("/coupon/select/category/{categoryId}")
    public Result<List<Coupon>> selectByCategoryId(@PathVariable Long categoryId);

    @ResponseBody
    @GetMapping("/coupon/select/goods/{goodsId}")
    public Result<List<Coupon>> selectByGoodsId(@PathVariable Long goodsId);


    @ResponseBody
    @GetMapping("/coupon/select/noStart")
    public Result<List<Coupon>> selectByNoStart(@CookieValue("adminTicket") String adminTicket);

    @ResponseBody
    @GetMapping("/couponHistory/user/{userId}")
    public Result<List<UserCouponShowVo>> selectCouponHistoryByUser(String userTicket);

    @ResponseBody
    @GetMapping("/couponHistory/isUserCoupon/{userId}/{couponHistoryId}")
    public Result<Boolean> isUserCoupon(@PathVariable Long userId,
                                        @PathVariable Long couponHistoryId);

    @ResponseBody
    @GetMapping("/couponHistory/couponInfo/{couponHistoryId}")
    public Result<CouponShowVo> selectCouponInfo(@PathVariable  Long couponHistoryId);
}
